package com.example.designpatterns.decorator;

// 装饰器基类：持有对组件的引用，并实现组件接口
public abstract class TextDecorator implements TextComponent {
    protected TextComponent textComponent;

    public TextDecorator(TextComponent textComponent) {
        this.textComponent = textComponent;
    }

    @Override
    public String getContent() {
        // 默认实现是直接返回被装饰组件的内容
        return textComponent.getContent();
    }

    @Override
    public void display() {
        // 默认显示被装饰组件的内容
        System.out.println(getContent());
    }
}